
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 12/07/2012 12:02:51
-- Generated from EDMX file: C:\Users\Mpipieri\Google Drive\Proyectos\Owned\Plataforma\Providers\Objetos\Model.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Core];
GO
IF SCHEMA_ID(N'core') IS NULL EXECUTE(N'CREATE SCHEMA [core]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[core].[Objetos]', 'U') IS NOT NULL
    DROP TABLE [core].[Objetos];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Objetos'
CREATE TABLE [core].[Objetos] (
    [Guid] uniqueidentifier  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Details] nvarchar(max)  NULL,
    [Deleted] bit  NULL
);
GO

-- Creating table 'Objetos_Cuenta'
CREATE TABLE [core].[Objetos_Cuenta] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Password] nvarchar(max)  NOT NULL,
    [Guid] uniqueidentifier  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Guid] in table 'Objetos'
ALTER TABLE [core].[Objetos]
ADD CONSTRAINT [PK_Objetos]
    PRIMARY KEY CLUSTERED ([Guid] ASC);
GO

-- Creating primary key on [Guid] in table 'Objetos_Cuenta'
ALTER TABLE [core].[Objetos_Cuenta]
ADD CONSTRAINT [PK_Objetos_Cuenta]
    PRIMARY KEY CLUSTERED ([Guid] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Guid] in table 'Objetos_Cuenta'
ALTER TABLE [core].[Objetos_Cuenta]
ADD CONSTRAINT [FK_Cuenta_inherits_Objeto]
    FOREIGN KEY ([Guid])
    REFERENCES [core].[Objetos]
        ([Guid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------